package com.wontube.smr.remote.admin;

import java.util.List;

import com.wontube.core.annotation.NoLoginSupport;
import com.wontube.core.cache.Cacher;
import com.wontube.core.cache.EHCacheKey;
import com.wontube.core.pub.servlet.handlers.BasicHandler;
import com.wontube.smr.dao.bo.HomeBannerSelectDao;
import com.wontube.smr.web.client.IWebHomeHandler;
import com.wontube.smr.web.client.admin.IAdminHomeBannerHandler;
import com.wontube.smr.web.client.model.po.HomeBanner;

@NoLoginSupport
public class AdminHomeBannerHandler extends BasicHandler implements IAdminHomeBannerHandler {

	@Override
	public boolean clearHomebannerCaches() {
		String clazzName = IWebHomeHandler.class.getName();
		Cacher.defaultCacher.deleteCache(clazzName, "listWebHome", new EHCacheKey(new Object[0]));
		Cacher.defaultCacher.deleteAllCache(clazzName, "listWebHome", 1);
		return true;
	}

	@Override
	public HomeBanner getHomeBannerByPK(String pk) {
		return HomeBannerSelectDao.getHomeBannerByPK(pk);
	}

	@Override
	public boolean saveOrUpdateHomeBanner(HomeBanner homeBanner) {
		return HomeBannerSelectDao.saveOrUpdateHomeBanner(homeBanner);
	}

	@Override
	public boolean deleteHomeBanner(String pk) {
		return HomeBannerSelectDao.deleteHomeBanner(pk);
	}

	@Override
	public List<HomeBanner> listHomeBanner() {
		return HomeBannerSelectDao.listHomeBanner();
	}

}
